Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update proxy.js #86

Closed
wants to merge 1 commit into from
Closed

Conversation

Its-Just-Nans
Copy link

@Its-Just-Nans Its-Just-Nans commented Nov 13, 2023

In Astro, when there is an error in our code, the page crash and it just display

[HMR][Svelte] Unrecoverable HMR error in <Component>: next update will trigger a full reload

as error. I think we should also log the error

@Its-Just-Nans
Copy link
Author

Its-Just-Nans commented Nov 20, 2023

@benmccann any ideas ?

@dominikg
Copy link
Member

can you share a minimal reproduction of this error please and show how this information would be useful to the user receiving these logs and what exactly would be logged?

What happens if there are multiple errors. logging all of them in full can cause a lot of extra output, so it might be better to set a breakpoint and observe the error when it is happening.

@Its-Just-Nans
Copy link
Author

Its-Just-Nans commented Nov 20, 2023

I don't have a reproducible example for now but for example

I have first the error

image

Then if I reload the page I got

image

Which is not helpful

@Its-Just-Nans
Copy link
Author

here is a Minimal example

https://stackblitz.com/edit/withastro-astro-j41nfv

Note that if you add

    "svelte": "^5.0.0-next.1"

to the package .json it's working normally

@dominikg
Copy link
Member

svelte5 does not use svelte-hmr, so no surprise there.

@dominikg
Copy link
Member

the example you shared has a lot of astro files that are not relevant, I see a Test.svelte component that has an obvious error (ee is not defined but used in the template). Are you saying that this is not communicated to you at all in your ide or browser?
cc @bluwy

@Its-Just-Nans
Copy link
Author

Thanks for the info on svelte5

The example show that with a svelte component, if there are errors (even an "obvious" one like ee is not defined, we don't have clear instructions.

We just have

[HMR][Svelte] Unrecoverable HMR error in <Test>: next update will trigger a full reload

Or sometimes (in a personal project for example) :

  • the page crash
  • the error is displayed
  • but if I reload the page, it crashes again but with [HMR][Svelte] Unrecoverable HMR error in <Test>: next update will trigger a full reload with only error

@dominikg
Copy link
Member

i was unable to see the error messages you mentioned in the stackblitz that has been provided.

Going from the astro svelte example, I saw the appropriate error popup when commenting count in Counter.svelte.

https://stackblitz.com/edit/github-asymdn?file=src%2Fcomponents%2FCounter.svelte,src%2Fpages%2Findex.astro

The difference to your example is that Counter is added with the astro directive client:visible. In your example you use client:only (which should be client:only="svelte") and in that case it does not show the error. I don't know what astro client:only does but i suggest you raise it with them.

Whatever is happening, the error of svelte-hmr won't help the user diagnose the problem in their code. If at all it would be helpful to show them the filename / component name that caused it. But the stacktrace is completely outside of the users code or reach.

@Its-Just-Nans
Copy link
Author

Okay thanks for the analysis

Here is the issue withastro/astro#9158

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants